<?php

namespace app\api\validate;

use think\Validate;

class Article extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'id'  =>  'require|integer|gt:0',
        'content'  =>  'require',
        'name'  =>  'require',
        'sex'  =>  'require|integer|in:1,2',
        'birthday'  =>  'require',
        'id_card'  =>  'require',
        'mobile'  =>  'require',

    ];
    /**
     * 提示消息
     */
    protected $message = [
        'id.require'  =>  '請求參數不能為空',
        'id.integer'  =>   '請求參數類型錯誤',
        'id.gt'  =>   '請求參數類型錯誤',
        'content.require'  =>  '請填寫評論',
        'name.require'  =>  '請輸入姓名',
        'sex.require'  =>  '請選擇性別',
        'sex.integer'  =>  '性別類型錯誤',
        'sex.in'  =>  '性別類型錯誤',
        'birthday.require'  =>  '請選擇出生日期',
        'id_card.require'  =>  '請輸入身份證號碼',
        'mobile.require'  =>  '請輸入手機號碼',
        // 'code.number'  =>   '编码必须是数字',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['name','type','code'],
        'info'  => ['id'],
        'activity_comment'  => ['id','content'],
        'signup'  => ['id','name','sex','birthday','id_card','mobile'],
        'signupj'  => ['id','name','sex','birthday','id_card','mobile'],
        'edit' => [],
    ];
    
}
